package com.belazy.library.util.exception;

import lombok.extern.slf4j.Slf4j;

/**
 * @Description <p> 断言工具类工具 </p>
 * @Author chupeng.tang
 * @CreateTime 2023/5/19 17:29
 * @Version 1.0
 */
@Slf4j
public class AssertUtil {
    private static final String ERROR_CODE = "400";
    /**
     * Throw AssertException if boo is false.
     *
     * @param boo
     * @param message
     * @param errorCode
     */
    public static void asserts(boolean boo, String message, String errorCode){
        if(!boo){
            throw new AssertException(message,errorCode);
        }
    }

    /**
     * Throw AssertException if boo is false.
     *
     * @param boo
     * @param message
     */
    public static void asserts(boolean boo, String message){
        asserts(boo,message,ERROR_CODE);
    }

    /**
     * Throw AssertException if boo is false.
     *
     * @param boo
     */
    public static void asserts(boolean boo){
        asserts(boo,ERROR_CODE);
    }
}
